var status = -1;
var beauty = 0;
var hair_Colo_new;

function start() {
    action(1, 0, 0)
}

function action(f, d, c) {
    if (f == 0) {
        cm.dispose();
        return
    } else {
        status++
    }
    if (status == 0) {
        cm.askMenu("这里是整形医院，只要你有美发卡，或者染发卡，你就把头发交给我吧。选择你想做的事情吧。\r\n#b#L0#更换发型(使用高级会员卡)#l\r\n#L1#染色(使用高级会员卡)#l")
    } else {
        if (status == 1) {
            if (c == 0) {
                var a = cm.getPlayerStat("HAIR");
                hair_Colo_new = [];
                beauty = 1;
                if (cm.getPlayer().getGender() == 0) {
                    hair_Colo_new = [32500, 36300, 36620, 33260, 36730, 33550, 30620, 36440, 30170, 34680, 36240, 36690, 36070, 36010, 36530, 30650, 33770, 30630, 30800, 33320, 36460, 33290, 33220, 30680, 36410, 33940, 30280, 34130, 30100, 33370, 34700, 33960, 33200, 31280, 33450, 33330, 30990, 33740, 33710, 30380, 36370, 33240, 30830, 33610, 33480, 33980, 33080, 33120, 33130, 36020, 33340, 36680, 33140, 36050, 33430, 33820, 33180, 33150, 30210, 33580, 30810, 36110, 30660, 30490, 36770, 36920, 36490, 36990, 36740, 36950, 36890, 36720, 36700, 36580, 33380, 33390, 36720, 31650, 36180, 33160, 35220, 35120, 35090, 36810, 36820, 36990, 36490, 32490, 36230, 33970, 33520, 36480, 36150, 36170, 36190, 36180, 36220, 36370, 36350, 33692, 35180]
                } else {
                    hair_Colo_new = [32500, 37020, 31060, 34560, 31890, 31610, 34330, 34880, 34860, 31770, 34890, 37580, 34770, 37310, 37410, 34640, 34650, 31250, 34900, 31930, 34060, 37420, 37050, 34750, 34040, 34310, 33680, 34510, 37190, 31540, 34430, 37720, 34850, 34470, 34970, 31640, 37180, 34840, 34670, 31710, 37060, 31760, 37090, 34260, 37200, 34870, 37380, 37010, 34480, 37230, 34630, 34610, 37300, 34780, 37510, 31940, 31180, 34790, 37530, 37610, 34450, 34410, 37540, 31900, 34250, 34230, 37320, 37550, 34950, 34400, 37210, 37250, 37460, 32140, 34180, 34210, 34220, 37000, 37760, 37340, 37280, 34590, 34600, 34730, 34800, 34960, 34810, 37560, 31990, 34720, 36400, 34990, 37030, 34940, 37440, 37520, 37680, 34710, 31130, 37700, 37290, 37920, 37860, 38070, 37900, 37830, 37630, 37950, 37690, 37810, 37880, 37890, 37710, 38240, 38150, 37980, 37970, 37820, 34840, 37350, 34950, 38220, 37640, 38020]
                }
                for (var b = 0; b < hair_Colo_new.length; b++) {
                    hair_Colo_new[b] = hair_Colo_new[b] + (a % 10)
                }
                cm.askAvatar("我可以帮你换成全新的发型。你厌倦了现在的发型了吗？只要你有#b万能会员卡#k，我就可以帮你更换发型。请慢慢挑选自己喜欢的发型～", hair_Colo_new, 5150052)
            } else {
                if (c == 1) {
                    var e = Math.floor((cm.getPlayerStat("HAIR") / 10)) * 10;
                    hair_Colo_new = [];
                    beauty = 2;
                    for (var b = 0; b < 8; b++) {
                        hair_Colo_new[b] = e + b
                    }
                    cm.askAvatar("我们可以为你改变头发的颜色。是不是已经厌倦了头发的颜色啊？如果你有#b万能会员卡#k，我就可以给你染发，慢慢挑选你喜欢的颜色吧！", hair_Colo_new, 5151036)
                }
            }
        } else {
            if (status == 2) {
                if (beauty == 1) {
                    if (cm.setAvatar(5151036, hair_Colo_new[c]) == 1) {
                        cm.sendOk("理发好了，怎么样？看看你的新发型吧！")
                    } else {
                        cm.sendOk("嗯……你好像没有美发店专用会员卡啊？不好意思，没有会员卡的话，我就不能帮你理发。")
                    }
                } else {
                    if (cm.setAvatar(5151036, hair_Colo_new[c]) == 1) {
                        cm.sendOk("好了，让朋友们赞叹你的新发色吧！")
                    } else {
                        cm.sendOk("嗯… 看来你没有我们美发店的会嘛！不好意思，如果没有会员卡，我们不可以给你染头发。")
                    }
                }
                cm.dispose()
            }
        }
    }
};